home *** CD-ROM | disk | FTP | other *** search
/ PC Player 2004 May / pc player 2004-05.iso / Demos / FarCry / Data1.cab / _A9A97C00C65E4696890426DEAF7ABAB3 < prev    next >
Encoding:
Text File  |  2004-01-06  |  8.8 KB  |  227 lines

  1. --------------------------------------------------
  2. --   Created By: Amanda
  3. --   Description: This behaviour describes the indoor swat personality in idle mode
  4. --------------------------
  5. --
  6.  
  7. AIBehaviour.SwatGroupAdvance = {
  8.     Name = "SwatGroupAdvance",
  9.  
  10.  
  11.     -- SYSTEM EVENTS    -----
  12.     ---------------------------------------------
  13.     OnSelected = function( self, entity )    
  14.     end,
  15.     ---------------------------------------------
  16.     OnSpawn = function( self, entity )
  17.         -- called when enemy spawned or reset
  18.     end,
  19.     ---------------------------------------------
  20.     OnActivate = function( self, entity )
  21.         -- called when enemy receives an activate event (from a trigger, for example)
  22.     end,
  23.     ---------------------------------------------
  24.     OnNoTarget = function( self, entity )
  25.         -- called when the enemy stops having an attention target
  26.     end,
  27.     ---------------------------------------------
  28.     OnPlayerSeen = function( self, entity, fDistance )
  29.         System:LogToConsole("["..entity:GetName().."]+SwatGroupAdvance++++++++++ OnPlayerSeen in "..fDistance);
  30.         if (fDistance<15) then
  31.             AI:Signal(SIGNALFILTER_GROUPONLY, 1, "ENEMY_CLOSE",entity.id);
  32.         end
  33.         --entity:InsertSubpipe(0,"DropBeaconAt");
  34.     end,
  35.     ---------------------------------------------
  36.     OnEnemyMemory = function( self, entity )
  37.     end,
  38.     ---------------------------------------------
  39.     OnInterestingSoundHeard = function( self, entity )
  40.         -- DO NOT TOUCH THIS READIBILITY SIGNAL    ---------------------------
  41.         AI:Signal(SIGNALID_READIBILITY, 1, "IDLE_TO_THREATENED",entity.id);
  42.         -------------------------------------------------------------------
  43.         entity:MakeAlerted();
  44.     --    entity:SelectPipe(0,"scout_interesting_sound");
  45.     end,
  46.     ---------------------------------------------
  47.     OnThreateningSoundHeard = function( self, entity )
  48.         -- DO NOT TOUCH THIS READIBILITY SIGNAL    ---------------------------
  49.         AI:Signal(SIGNALID_READIBILITY, 1, "IDLE_TO_THREATENED",entity.id);
  50.         -------------------------------------------------------------------
  51.         entity:MakeAlerted();
  52.     end,
  53.     ---------------------------------------------
  54.     OnReload = function( self, entity )
  55.         -- called when the enemy goes into automatic reload after its clip is empty
  56.     end,
  57.     ---------------------------------------------
  58.     OnNoHidingPlace = function( self, entity, sender )
  59.         -- called when no hiding place can be found with the specified parameters
  60.         System:LogToConsole("["..entity:GetName().."]+SwatGroupAdvance++++++++++++ OnNoHidingPlace");
  61.         entity:SelectPipe(0,"swat_noHide");
  62.     end,    
  63.     ---------------------------------------------
  64.     OnReceivingDamage = function ( self, entity, sender)
  65.         -- called when the enemy is damaged
  66.         AI:Signal(SIGNALFILTER_GROUPONLY, 1, "INCOMING_FIRE",entity.id);
  67.  
  68.         -- DO NOT TOUCH THIS READIBILITY SIGNAL    ------------------------
  69.         AI:Signal(SIGNALID_READIBILITY, 1, "GETTING_SHOT_AT",entity.id);
  70.         ----------------------------------------------------------------
  71.  
  72.         entity:MakeAlerted();
  73.     --    entity:SelectPipe(0,"randomhide");
  74.     end,
  75.     --------------------------------------------------
  76.     OnBulletRain = function ( self, entity, sender)
  77.         -- called when detect weapon fire around AI
  78.     
  79.         AI:Signal(SIGNALFILTER_GROUPONLY, 1, "INCOMING_FIRE",entity.id);
  80.         
  81.         entity:MakeAlerted();
  82.     --    entity:SelectPipe(0,"randomhide");
  83.     end,
  84.     --------------------------------------------------
  85.     OnGrenadeSeen = function( self, entity, fDistance )
  86.         -- called when the enemy sees a grenade
  87.         AI:Signal(SIGNALID_READIBILITY, 2, "GRENADE_SEEN",entity.id);
  88.     --    entity:InsertSubpipe(0,"grenade_run_away");
  89.     end,
  90.     --------------------------------------------------    
  91.     OnCoverRequested = function ( self, entity, sender)
  92.         -- called when cover is requested
  93.     end,
  94.     --------------------------------------------------    
  95.     SCOUT_HIDE_LEFT_OR_RIGHT = function ( self, entity, sender)
  96.         local rnd = random(1,2);
  97.         if (rnd == 1) then
  98.             --System:LogToConsole("+++++++++++++++++++++++++++IDLE scout_hide_left");
  99.             entity:InsertSubpipe(0,"scout_hide_left");
  100.         else
  101.             --System:LogToConsole("+++++++++++++++++++++++++++IDLE scout_hide_right");
  102.             entity:InsertSubpipe(0,"scout_hide_right");
  103.         end
  104.         
  105.     end, 
  106.     --------------------------------------------------
  107.     ----------------- GROUP SIGNALS ------------------
  108.     --------------------------------------------------
  109.     INCOMING_FIRE = function (self, entity, sender)
  110.         if (entity ~= sender) then
  111.             -- entity:SelectPipe(0,"randomhide");
  112.         end
  113.     end,
  114.     -------------------------------------------------    
  115.     OnGroupMemberDied = function( self, entity, sender)
  116.         -- call default handling
  117.         entity:SelectPipe(0,"swat_goforcover");
  118.     end,
  119.     --------------------------------------------------
  120.     OnGroupMemberDiedNearest = function ( self, entity, sender)
  121.         -- call default handling
  122.         if (AI:GetGroupCount(entity.Properties.groupid) > 1) then
  123.             entity:SelectPipe(0,"swat_advance");
  124.             entity:InsertSubpipe(0,"swat_grouphide");
  125.         else
  126.             AI:Signal(SIGNALFILTER_GROUPONLY, 1, "ENEMY_CLOSE",entity.id);
  127.         end
  128.     end,
  129.     -------------------------------------------------    
  130.     ----------------- SWAT SIGNALS ------------------
  131.     ENEMY_CLOSE  = function (self, entity, sender)
  132.         entity:SelectPipe(0,"swat_coverattack");
  133.     end,
  134.     -------------------------------------------------    
  135.     SUSPRESSION_FIRE  = function ( self, entity, sender)
  136.         -- entity:InsertSubpipe(0,"swat_suspress");
  137.         if (entity ~= sender) then 
  138.             System:LogToConsole(entity:GetName().." .. SUSPRESSION_FIRE");
  139.             entity:InsertSubpipe(0,"swat_suspress");
  140.         end
  141.     end,
  142.     --------------------------------------------------    
  143.     WAIT_I_GO = function ( self, entity, sender)
  144.         if (entity ~= sender) then 
  145.             entity:SelectPipe(0,"swat_grouphide");
  146.         end
  147.     end,
  148.     
  149.     --------------------------------------------------        
  150.     NO_RESPOND = function ( self, entity, sender)
  151.         if (entity ~= sender) then 
  152.             AI:Signal(0,1,"SELECT_BACKREADY",entity.id);
  153.         elseif (entity == sender) then 
  154.             entity:SelectPipe(0,"swat_grouphide");
  155.             entity:InsertSubpipe(0,"swat_signal_NEXT_ADVANCE");
  156.         end
  157.     end,
  158.     --------------------------------------------------    
  159.     SELECT_GROUPADVANCE = function ( self, entity, sender)
  160.     end,
  161.     --------------------------------------------------    
  162.     SELECT_GROUPWAIT = function ( self, entity, sender)
  163.     end,
  164.     --------------------------------------------------    
  165.     SELECT_GROUPREADY = function ( self, entity, sender)
  166.     end,
  167.     ----------------- SWAT SIGNALS ------------------
  168.     -------------------------------------------------
  169.     KEEP_FORMATION = function (self, entity, sender)
  170.         -- the team leader wants everyone to keep formation
  171.     end,
  172.     ---------------------------------------------    
  173.     MOVE_IN_FORMATION = function (self, entity, sender)
  174.         -- the team leader wants everyone to move in formation
  175.     
  176.         -- DO NOT TOUCH THIS READIBILITY SIGNAL    ---------------------------
  177.         AI:Signal(SIGNALID_READIBILITY, 2, "ORDER_RECEIVED",entity.id);
  178.         -------------------------------------------------------------------
  179.  
  180.         entity:SelectPipe(0,"MoveFormation");
  181.     end,
  182.     ---------------------------------------------    
  183.     BREAK_FORMATION = function (self, entity, sender)
  184.         -- the team can split
  185.     end,
  186.     ---------------------------------------------    
  187.     SINGLE_GO = function (self, entity, sender)
  188.         -- the team leader has instructed this group member to approach the enemy
  189.     end,
  190.     ---------------------------------------------    
  191.     GROUP_COVER = function (self, entity, sender)
  192.         -- the team leader has instructed this group member to cover his friends
  193.     end,
  194.     ---------------------------------------------    
  195.     IN_POSITION = function (self, entity, sender)
  196.         -- some member of the group is safely in position
  197.     end,
  198.     ---------------------------------------------    
  199.     GROUP_SPLIT = function (self, entity, sender)
  200.         -- team leader instructs group to split
  201.     end,
  202.     ---------------------------------------------    
  203.     PHASE_RED_ATTACK = function (self, entity, sender)
  204.         -- team leader instructs red team to attack
  205.     end,
  206.     ---------------------------------------------    
  207.     PHASE_BLACK_ATTACK = function (self, entity, sender)
  208.         -- team leader instructs black team to attack
  209.     end,
  210.     ---------------------------------------------    
  211.     GROUP_MERGE = function (self, entity, sender)
  212.         -- team leader instructs groups to merge into a team again
  213.     end,
  214.     ---------------------------------------------    
  215.     CLOSE_IN_PHASE = function (self, entity, sender)
  216.         -- team leader instructs groups to initiate part one of assault fire maneuver
  217.     end,
  218.     ---------------------------------------------    
  219.     ASSAULT_PHASE = function (self, entity, sender)
  220.         -- team leader instructs groups to initiate part one of assault fire maneuver
  221.     end,
  222.     ---------------------------------------------    
  223.     GROUP_NEUTRALISED = function (self, entity, sender)
  224.         -- team leader instructs groups to initiate part one of assault fire maneuver
  225.     end,
  226.     ------------------------------------------------------------------------
  227. }